export default {
    generateRouters(menu) {

        let routers = [];

        function deepList(menu) {

            while (menu.length) {

                let item = menu.pop()

                if (item.action) {

                    routers.push({
                        path: item.path,
                        component: item.component,
                        name: item.component,
                        meta: { title: item.menuName }
                    })
                }

                if (item.children && item.children.length > 0) {

                    deepList(item.children)

                }

            }
        }

        deepList(menu)

        return routers

    }
}